package com.dsz.usercenter.common;

/**
 * 通过结果返回工具类
 */
public class ResultUtil {
    public static <T> BaseResponse<T> ok(T data) {
        return new BaseResponse<>(0, data, "请求成功", "");
    }

    public static <T> BaseResponse<T> fail(ErrorCode errorCode) {
        return new BaseResponse<>(errorCode.getCode(), null, errorCode.getMessage(), errorCode.getDescription());
    }

    public static <T> BaseResponse<T> fail(Integer code, String message, String description) {
        return new BaseResponse<>(code, null, message, description);
    }
}
